package dialogencapsulation.qu.com.dialogencapsulation.InputBox;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Toast;

import butterknife.Bind;
import butterknife.ButterKnife;
import dialogencapsulation.qu.com.dialogencapsulation.R;

public class InputBoxActivity extends AppCompatActivity {
    private LinearLayout ll_comment;
    private FrameLayout lay_container;
    private CommentBar mDelegation;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_input_box);
        ButterKnife.bind(this);
        initWidget();
    }
    //初始化
    private void initWidget() {
        ll_comment = (LinearLayout) findViewById(R.id.ll_comment);
        lay_container = (FrameLayout) findViewById(R.id.lay_container);
        mDelegation = CommentBar.delegation(this, ll_comment);
        mDelegation.setCommentHint("发表评论");
        mDelegation.getBottomSheet().getEditText().setHint("发表评论");
        mDelegation.getBottomSheet().hideSyncAction();
        mDelegation.getBottomSheet().showEmoji();
        //收藏
        mDelegation.setFavListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(InputBoxActivity.this,"收藏......",Toast.LENGTH_SHORT).show();
            }
        });

        //分享
        mDelegation.setShareListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(InputBoxActivity.this,"分享......",Toast.LENGTH_SHORT).show();
            }
        });

        //@某人的功能
        mDelegation.getBottomSheet().setMentionListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(InputBoxActivity.this,"@某人的功能",Toast.LENGTH_SHORT).show();
            }
        });

        //发送评论
        mDelegation.getBottomSheet().setCommitListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                 Toast.makeText(InputBoxActivity.this,mDelegation.getBottomSheet().getCommentText(),Toast.LENGTH_SHORT).show();
                  mDelegation.getBottomSheet().getBtnCommit().setEnabled(false);
                  mDelegation.getBottomSheet().dismiss();
             /*   mDelegation.getBottomSheet().dismiss();
                mDelegation.setCommitButtonEnable(true);
                mDelegation.getCommentText().setHint("发表评论");
                mDelegation.getBottomSheet().getEditText().setText("");
                mDelegation.getBottomSheet().getEditText().setHint("发表评论");
                mDelegation.getBottomSheet().dismiss();*/
            }
        });
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}
